package com.zl.util;

import java.sql.Date;
import java.text.SimpleDateFormat;

public class ZLString {
	/**
	 * 判断是否为空
	 * @param str
	 * @return
	 */
	public static boolean isEmpty(String str){
		if(str==null || "".equals(str.trim())){
			return true;
		}else{
			return false;
		}
	}
	
	/**
	 * 判断是否非空
	 * @param str
	 * @return
	 */
	public static boolean isNotEmpty(String str){
		if(str!=null && !"".equals(str.trim())){
			return true;
		}else{
			return false;
		}
	}
	
	/**
	 * 时间戳转字符串
	 * @param seconds
	 * @return
	 */
	public static String timeStamp2Date(String seconds) {  
		
		if(seconds == null || seconds.isEmpty() || seconds.equals("null")){ 
			
			return "";  
		}  
		
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	       
	       return df.format(new Date(Long.valueOf(seconds))); 
	       
	}
	
	 public static String date2TimeStamp(String date_str){  
		
		 try {  
			 
			SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
			return String.valueOf(df.parse(date_str).getTime()); 
			
		} catch (Exception e) {  
			
			e.printStackTrace();  
		}  
		return "";  
	}  
}
